package cn.wenzy.aurora.framework.support.validation.properties;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.Map;

@Data
@ConfigurationProperties(prefix = "aurora.validation")
public class ValidationProperties {
    private Map<String, ValidationRule> validationRule;

    public ValidationProperties(){
        validationRule = new HashMap<>();
    }

    public ValidationRule getValidationRule(String ruleCode) {
        if (StrUtil.isBlank(ruleCode)) {
            return null;
        }
        return validationRule.get(ruleCode);
    }
}
